# _*_ coding: UTF-8 _*_
# @Time     : 2021/10/21 10:18
# @Author   : yangshuaishuai
# @Site     : http://www.hzdledu.cn/
# @File     : c4s1算术运算符.py
# @Software : PyCharm
# 算术运算符
print(5 / 3)
print(5 % 3)  # 取余数
print(5 ** 3)  # 幂运算
print(5 // 3)  # 取整除
# 比较运算符
# 运算数据，得到布尔值
a = 5
b = 3
c = 1
print(a == b)  # False
print(a != b)  # True
print(a > b)  # True
print(a < b)  # False

print(a > b and b > c)
print(a > b > c)  # python特有

# 逻辑运算符
# 运算bool值，得到bool值
a = True
b = False
print(a and b)
print(a or b)
print(not a)

a = 100
b = 0
print(a and b)
print(a or b)
print(not a)

# 赋值运算符
a = 10  # 把10赋值与a,把右边赋值给左边，先右后左
b = 5
a += b  # a= a+b
print(a)

a = 1
b = 2
a += a * b  # a = a+(a*b)

# 位和位移符
print(5 & 3)
print(5 | 3)
print(~5)
print(4 >> 1)
print(4 << 1)

# 其他运算符
# in:成员运算符,结果是布尔值
print(3 in (3, 5, 7, 9))
print(3 not in (3, 5, 7, 9))

# 运算优先级
a = 3
b = 5
a = a and b * 1024  # 用（）提高优先级
